package com.zpark;

import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;

/**
 * @PackageName: com.zpark
 * @ClassName: SpringBootTest01
 * @Description:
 * @author: RZS
 * @date: 2023/5/5  16:35
 */
@SpringBootTest
public class SpringBootTest01 {

    // 定义日志对象
    Logger log = LoggerFactory.getLogger(getClass());

    @Autowired
    private ApplicationContext ioc;

    @Test
    public void test(){
        System.out.println(ioc.containsBean("userService"));
        System.out.println(ioc.containsBean("testDemo01"));
    }

    @Test
    public void test2(){

        log.trace("trace");
        log.debug("debug");
        log.info("info");
        log.warn("warn");
        log.error("error");

        try {
            int num = 2 / 0;
        } catch(Exception e) {
            log.error("除数不允许为0");
        } finally {
            log.info("程序运行结束");
        }
    }
}
